import { ORDER_STATUS_OPTIONS, PURCHASEWAY_OPTIONS } from '@/constant/purchase'
import { IOptionClass } from '@/hooks/useGetClassIds'
import { Empty } from 'antd'
export const searchConfig = ({
  TemplateOptions,
  handleSearchTemplate,
  classIdOptions,
  settinyClassIds,
  handleClassIdChange,
}: {
  TemplateOptions: IOptionItem[]
  handleSearchTemplate: (newValue?: string) => void
  classIdOptions: IOptionClass[]
  settinyClassIds: React.Dispatch<React.SetStateAction<string[]>>
  handleClassIdChange: (_: React.Key[], data: IOptionClass[]) => string[]
}) => {
  return [
    {
      name: 'fineClassIds',
      label: '款式分类',
      type: 'Cascader',
      option: classIdOptions,
      placeholder: '请选择款式分类',
      config: {
        changeOnSelect: true,
        onChange: handleClassIdChange,
        onClear: () => settinyClassIds([]),
        fieldNames: { label: 'className', value: 'classConfigId', children: 'childrenList' },
      },
    },
    {
      label: '采购方式',
      name: 'purchaseType',
      type: 'Select',
      option: PURCHASEWAY_OPTIONS,
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
    },
    {
      name: 'templateIds',
      label: '商品信息模板',
      type: 'Select',
      option: TemplateOptions,
      placeholder: '请选择商品信息模板',
      config: {
        suffixIcon: null,
        showSearch: true,
        filterOption: false,
        optionFilterProp: 'label',
        mode: 'multiple',
        onSearch: handleSearchTemplate,
        notFoundContent: <Empty description="请输入内容搜索" image={Empty.PRESENTED_IMAGE_SIMPLE} />,
      },
    },
  ]
}
